﻿@page
@model AdminUI.Pages.IndexModel
@{
    var F = Html.F();
}

@section head {

    <link type="text/css" rel="stylesheet" href="~/res/css/index.css?v@(GlobalConfig.ProductVersion)1" />
    @* <link type="text/css" rel="stylesheet" href="~/res/css/mobileview.css?v@(GlobalConfig.ProductVersion)" /> *@

}

@functions {

    private void SetCheckedMenuItem(MenuButton menuButton, string checkedValue)
    {
        foreach (MenuItem item in menuButton.Menu.Items)
        {
            MenuCheckBox checkBox = (item as MenuCheckBox);
            if (checkBox != null)
            {
                checkBox.Checked = checkBox.AttributeDataTag == checkedValue;
            }
        }
    }

}


@section body {


    <f:Panel ID="mainPanel" Layout="Region" CssClass="mainpanel" ShowBorder="false" ShowHeader="false" IsViewPort="true">
        <Items>
            <f:Panel ID="sidebarRegion" CssClass="sidebarregion bgpanel" RegionPosition="Left" ShowBorder="false" Width="220" ShowHeader="false"
                     EnableCollapse="false" Collapsed="false" Layout="VBox" RegionSplit="true" RegionSplitIcon="false" RegionSplitWidth="3" RegionSplitTransparent="true">
                <Items>
                    <f:ContentPanel ID="sideheaderTopPanel" CssClass="topregion" ShowBorder="false" ShowHeader="false">
                        <div id="sideheader" class="f-widget-header f-mainheader">
                            <a class="logo" href="@Url.Content("~/")" title="@ViewBag.Title">@ViewBag.Title</a>
                            <div class="logo-subtitle">v1.0</div>
                        </div>
                    </f:ContentPanel>
                    <f:Panel ID="leftPanel" CssClass="leftregion" BoxFlex="1" ShowBorder="true" ShowHeader="false" Layout="Fit">
                        <Items>
                            <f:Tree ID="treeMenu" ShowBorder="false" ShowHeader="false" HideVScrollbar="true" EnableSingleClickExpand="true" EnableSingleExpand="false" Nodes="@(TreeNode[])ViewBag.TreeMenuNodes"></f:Tree>
                        </Items>
                    </f:Panel>
                </Items>
                <Listeners>
                    <f:Listener Event="splitdrag" Handler="onSidebarSplitDrag" />
                </Listeners>
            </f:Panel>
            <f:Panel ID="bodyRegion" CssClass="bodyregion" RegionPosition="Center" ShowBorder="false" ShowHeader="false" Layout="VBox">
                <Items>
                    <f:ContentPanel ID="topPanel" CssClass="topregion" ShowBorder="false" ShowHeader="false">
                        <div id="header" class="f-widget-header f-mainheader">
                            <div class="header-left">
                                <f:Button ID="btnCollapseSidebar" CssClass="icononlyaction" ToolTip="折叠/展开侧边栏" IconAlign="Top" IconFont="_Fold" EnableDefaultState="false" EnableDefaultCorner="false" TabIndex="-1">
                                    <Listeners>
                                        <f:Listener Event="click" Handler="onFoldClick" />
                                    </Listeners>
                                </f:Button>
                                <div id="breadcrumb">
                                    <div class="breadcrumb-inner">
                                        <span class="breadcrumb-last">首页</span>
                                    </div>
                                    <div class="breadcrumb-icons">
                                        @*<a data-qtip="查看源代码" href="javascript:onToolSourceCodeClick();"><i class="f-icon f-iconfont f-iconfont-code"></i></a>*@
                                        <a data-qtip="刷新本页" href="javascript:onToolRefreshClick();"><i class="f-icon f-iconfont f-iconfont-refresh"></i></a>
                                        <a data-qtip="在新标签页中打开" href="javascript:onToolNewWindowClick();"><i class="f-icon f-iconfont f-iconfont-new-tab"></i></a>
                                    </div>
                                </div>
                            </div>
                            <div class="header-right">
                                <f:Button CssClass="icononlyaction" ID="btnThemeSelect" ToolTip="主题仓库" IconAlign="Top" IconFont="_Skin" Hidden="false" EnableDefaultState="false" EnableDefaultCorner="false" TabIndex="-1">
                                    <Listeners>
                                        <f:Listener Event="click" Handler="onThemeSelectClick" />
                                    </Listeners>
                                </f:Button>
                                <f:Button CssClass="userpicaction" Text="当前用户：@ViewBag.User.TrueName" EnableDefaultState="false" EnableDefaultCorner="false">
                                    <Menu ID="menuSettings">
                                        <f:MenuButton Text="主选项卡标签" ID="MenuMainTabs">
                                            <Menu>
                                                <Items>
                                                    <f:MenuCheckBox Text="多标签页" ID="MenuMainTabsMulti" AttributeDataTag="multi" Checked="true" GroupName="MenuMainTabs">
                                                    </f:MenuCheckBox>
                                                    <f:MenuCheckBox Text="单标签页" ID="MenuMainTabsSingle" AttributeDataTag="single" GroupName="MenuMainTabs">
                                                    </f:MenuCheckBox>
                                                </Items>
                                                <Listeners>
                                                    <f:Listener Event="checkchange" Handler="onMenuMainTabsCheckChange" />
                                                </Listeners>
                                            </Menu>
                                        </f:MenuButton>
                                        <f:MenuButton Text="选择语言" ID="MenuLang" Hidden="true">
                                            <Menu>
                                                <Items>
                                                    <f:MenuCheckBox Text="简体中文" ID="MenuLangZHCN" AttributeDataTag="zh_CN" Checked="true" GroupName="MenuLang">
                                                    </f:MenuCheckBox>
                                                    <f:MenuCheckBox Text="繁體中文" ID="MenuLangZHTW" AttributeDataTag="zh_TW" GroupName="MenuLang">
                                                    </f:MenuCheckBox>
                                                    <f:MenuCheckBox Text="English" ID="MenuLangEN" AttributeDataTag="en" GroupName="MenuLang">
                                                    </f:MenuCheckBox>
                                                </Items>
                                                <Listeners>
                                                    <f:Listener Event="checkchange" Handler="onMenuLangCheckChange" />
                                                </Listeners>
                                            </Menu>
                                        </f:MenuButton>
                                        <f:MenuButton Text="加载动画">
                                            <Listeners>
                                                <f:Listener Event="click" Handler="onLoadingSelectClick" />
                                            </Listeners>
                                        </f:MenuButton>
                                        <f:MenuSeparator></f:MenuSeparator>
                                        <f:MenuButton Text="修改密码">
                                            <Listeners>
                                                <f:Listener Event="click" Handler="onModifyPwdClick" />
                                            </Listeners>
                                        </f:MenuButton>
                                        <f:MenuButton ID="btnSignOut" Text="安全退出" IconFont="_SignOut" ConfirmText="确定退出系统？" OnClick="@Url.Handler("btnSignOut_Click")">
                                        </f:MenuButton>
                                    </Menu>
                                </f:Button>
                            </div>
                        </div>
                    </f:ContentPanel>
                    <f:TabStrip ID="mainTabStrip" CssClass="centerregion" ShowInkBar="true" InkBarPosition="Top" BoxFlex="1" ShowBorder="true" EnableTabCloseMenu="true" ShowTabHeader="@(ViewBag.CookieMainTabs=="multi")">
                        <Tabs>
                            <f:Tab ID="tabHomepage" Title="首页" IconFont="_Home" EnableIFrame="true" IFrameUrl="@ViewBag.HomeUrl">
                            </f:Tab>
                        </Tabs>
                        <Tools>
                            @*<f:Tool IconFont="_Code" CssClass="tabtool viewcode" ToolTip="查看源代码" ID="toolSourceCode">
                                <Listeners>
                                    <f:Listener Event="click" Handler="onToolSourceCodeClick" />
                                </Listeners>
                            </f:Tool>*@
                            <f:Tool IconFont="_Refresh" CssClass="tabtool" ToolTip="刷新本页" ID="toolRefresh">
                                <Listeners>
                                    <f:Listener Event="click" Handler="onToolRefreshClick" />
                                </Listeners>
                            </f:Tool>
                            <f:Tool IconFont="_NewTab" CssClass="tabtool" ToolTip="在新标签页中打开" ID="toolNewWindow">
                                <Listeners>
                                    <f:Listener Event="click" Handler="onToolNewWindowClick" />
                                </Listeners>
                            </f:Tool>
                        </Tools>
                    </f:TabStrip>
                </Items>
            </f:Panel>
        </Items>
    </f:Panel>

@*    <f:Window ID="windowSourceCode" IconFont="_Code" Title="源代码" Hidden="true" EnableIFrame="true"
              IsModal="true" Width="1000" Height="600" EnableClose="true" EnableMaximize="true" EnableResize="true">
    </f:Window>*@
    <f:Window ID="windowThemeRoller" Title="主题仓库" Hidden="true" EnableIFrame="true" IFrameUrl="@Url.Content("~/Home/Themes")" ClearIFrameAfterClose="false"
              IsModal="true" Width="1000" Height="600" EnableClose="true" EnableMaximize="true" EnableResize="true" WindowPosition="Center">
    </f:Window>
    <f:Window ID="windowLoadingSelector" Title="加载动画" Hidden="true" EnableIFrame="true" IFrameUrl="@Url.Content("~/Home/Loading")" ClearIFrameAfterClose="false"
              IsModal="true" Width="1000" Height="600" EnableClose="true" EnableMaximize="true" EnableResize="true">
    </f:Window>

@*    <f:Window ID="windowApplyTrial" Title="企业版试用" Hidden="true"
              IsModal="true" Width="450" EnableClose="true" EnableMaximize="false" BodyPadding="15" IconFont="_Mail">
        <Content>
            <div>
                请填写如下资料发送到邮箱：2877408506@qq.com
            </div>
            <ul class="applytrial">
                <li>产品名称：FineUICore（企业版）</li>
                <li>单位全称：XXX单位</li>
                <li>申请人邮箱：XXX</li>
                <li>申请人QQ：XXX</li>
                <li>申请人姓名：XXX</li>
                <li>申请人地址：XX省XX市</li>
                <li>申请人电话：XXXXXXX</li>
            </ul>
        </Content>
    </f:Window>*@
    <f:Window ID="Window1" IsModal="true" Hidden="true" Target="Top" EnableResize="true" EnableMaximize="true" EnableIFrame="true" Width="750" Height="500">
    </f:Window>

    <f:HiddenField ID="hfExamplesCount" Text="@ViewBag.ExamplesCount"></f:HiddenField>


    @{
        string cookieMenuStyle = (string)ViewBag.CookieMenuStyle;
        string cookieDisplayMode = (string)ViewBag.CookieDisplayMode;
        string cookieMainTabs = (string)ViewBag.CookieMainTabs;
        string cookieLang = (string)ViewBag.CookieLang;
        string cookieSearchText = (string)ViewBag.CookieSearchText;

        // 初始化左侧菜单
        FineUICore.Tree treeMenu = F.GetControl<FineUICore.Tree>("treeMenu");
        if (cookieMenuStyle == "tree")
        {
            treeMenu.HideHScrollbar = true;
            treeMenu.HideVScrollbar = true;
            treeMenu.ExpanderToRight = true;
            treeMenu.HeaderStyle = true;
            treeMenu.AllHeaderStyle = true;
        }

        // 初始化设置 - 主选项卡标签
        SetCheckedMenuItem(F.GetControl<MenuButton>("MenuMainTabs"), cookieMainTabs);

        // 初始化设置 - 语言
        SetCheckedMenuItem(F.GetControl<MenuButton>("MenuLang"), cookieLang);

        // 初始化搜索文本
        var ttbxSearch = F.GetControl<TwinTriggerBox>("ttbxSearch");
        if (!String.IsNullOrEmpty(cookieSearchText))
        {
            ttbxSearch.Text = cookieSearchText;
            ttbxSearch.ShowTrigger1 = true;
            ttbxSearch.Width = 200;
            ttbxSearch.CssClass = "searchbox expanded";
        }

    }

}





@section script {

    <script>
        var PARAMS = {
            mainPanel: 'mainPanel',
            mainTabStrip: 'mainTabStrip',
            treeMenu: 'treeMenu',
            sidebarRegion: 'sidebarRegion',
            btnCollapseSidebar: 'btnCollapseSidebar',
            tabHomepage: 'tabHomepage',
            windowSourceCode: 'windowSourceCode',
            windowThemeRoller: 'windowThemeRoller',
            windowLoadingSelector: 'windowLoadingSelector',
            //windowApplyTrial: 'windowApplyTrial',
            hfExamplesCount: 'hfExamplesCount',
            sourceUrl: '@Url.Content("~/Home/Source")',
            dashboardUrl: '@Url.Content("~/Block/Dashboard")',
            mainUrl: '@Url.Content("~/Home/Main")',
            processNewWindowUrl: function (url) {
                return url.replace(/\/Mobile\/\?file=/ig, '/Mobile/');
            }
        };


        //修改当前登录用户密码
        function onModifyPwdClick(event) {
            var path = "/SysManage/ModifyPwd";
            F.ui.Window1.show(path, '修改密码', 400, 300);
        }

        //F.ready(function () {

        //});

    </script>

    <script src="~/res/js/index.js?v@(GlobalConfig.ProductVersion)"></script>

}

